/**
 * 
 */
package com.trmp.commons.exception;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author divine
 *
 */
public class ExceptionHandler implements HandlerExceptionResolver {

	protected final transient Log log = LogFactory.getLog(ExceptionHandler.class);
	
	@Override
	public ModelAndView resolveException(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception e) {
		
		Map<String, Object> model = new HashMap<String, Object>();
		model.put("exception", e);
		log.debug("exception is: ", e);
		return new ModelAndView("/404", model);
	}

}
